<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<html>
<head>
    <meta charset="UTF-8">
    <title>书虫之家购物系统</title>

    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css">

    <link rel='stylesheet'
          href='https://fonts.googleapis.com/css?family=Roboto:400,100,300,500,700,900|RobotoDraft:400,100,300,500,700,900'>
    <link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css'>

    <link rel="stylesheet" href="css/style.css">


</head>

<body>


<!-- Form Mixin-->
<!-- Input Mixin-->
<!-- Button Mixin-->
<!-- Pen Title-->
<div class="pen-title">
    <h1>书虫之家购物系统</h1>
</div>
<!-- Form Module-->
<div class="module form-module">
    <div class="toggle"><i class="fa fa-times fa-pencil"></i>
        <div class="tooltip">点我注册</div>
    </div>
    <div class="form">
        <h2>登录书虫之家购物系统</h2>
        <form form action="/bookstore/UserServlet" method="post">
            <input type="hidden" name="method" value="login"/>
            <input type="text" name="username" placeholder="用户名" required=""/>
            <input type="password" name="password" placeholder="密码" required=""/>
            <%
                String errors1 = (String) request.getSession().getAttribute("errors1");
                if (errors1 != null) {
                    out.print("<p style=\"color: red\">" + errors1 + "</p><br/>");
                    request.getSession().setAttribute("errors1", null);
                }
            %>
            <button>登录</button>
        </form>
    </div>
    <div class="form">
        <h2>注册账号</h2>
        <form action="/bookstore/UserServlet" method="post">
            <input type="hidden" name="method" value="register"/>
            <input type="text" name="username" placeholder="用户名（3-15位）" required=""/>
            <input type="password" name="password" placeholder="密码（3-15位）" required=""/>
            <input type="email" name="email" placeholder="邮箱" required=""/>
            <%
                String errors2 = (String) request.getSession().getAttribute("errors");
                if (errors2 != null) {
                    out.print("<p style=\"color: red\">" + errors2 + "</p><br/>");
                    request.getSession().setAttribute("errors2", null);
                }
            %>
            <button>注册</button>
        </form>
    </div>
</div>
<script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='https://codepen.io/andytran/pen/vLmRVp.js'></script>


<script src="js/index.js"></script>


</body>

</html>
